/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-05-04 09:50:21
 * @LastEditTime : 2023-05-15 15:18:28
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\DataSynchronization.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList, BuiltInData } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton } from '../Common/options'

export const DataSynchronization = async ({ url, OptionsEvent }) => {
    let data = {
        type: '系统配置',
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`get${url}GetListAll`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        hideInSearch: true,
        options: [<AddDataButton OptionsEvent={OptionsEvent} url={url} type="primary" icon="add" title="新增管理端" />],
        columns: [
            commonTableList.uuid,
            {
                dataIndex: 'centName',
                title: '管理端名称',
                valueType: 'input',
                ellipsis: true,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'centerPushUrl',
                title: '上传数据接口地址头',
                valueType: 'input',
                ellipsis: true,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'centerTokenUrl',
                title: '获取token地址',
                valueType: 'input',
                ellipsis: true,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'centerTokenInfo',
                title: '获取token详情',
                valueType: 'input',
                ellipsis: true,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'tokenCacheKey',
                title: 'token缓存key',
                valueType: 'input',
                ellipsis: true,
                rules: true,
                width: 150,
            },

            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 200,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <DelDataButton
                            OptionsEvent={OptionsEvent}
                            key="delete"
                            title="删除"
                            url={url}
                            uuid={record.uuid}
                        />,
                    ]
                },
            },
        ],
    }
    return data
}
